//
//  ADNaviManager.m
//  Anda_Driver_Pro
//
//  Created by AnDa-Y on 2019/8/7.
//  Copyright © 2019 AnDa-Y. All rights reserved.
//

#import "ADNaviManager.h"


@interface ADNaviManager ()
@property (strong, nonatomic) id<ADNaviManagerProtocol> naviManager;
@end

@implementation ADNaviManager

@synthesize delegate, navigationStatus, isSimulateNav;

- (instancetype)init
{
    if(self = [super init]){
        self.naviManager = [[ADMANaviManager alloc]init];
    }
    return self;
}

- (void)setDelegate:(id<ADNavigationManagerDelegate>)delegate
{
    self.naviManager.delegate = delegate;
}

- (void)addDriveView:(nonnull ADNaviDriveView *)driveView {
    [self.naviManager addDriveView:driveView];
}

- (void)adjustShowLocation {
    [self.naviManager adjustShowLocation];
}

- (void)adjustShowTrafficLayer {
    [self.naviManager adjustShowTrafficLayer];
}

- (void)destroySelf {
    [self.naviManager destroySelf];
}

- (BOOL)startFullScreenNavigation
{
    return [self.naviManager startFullScreenNavigation];
}

- (void)mapDidLoadOnView:(UIView *)aView
{
    [self.naviManager mapDidLoadOnView:aView];
}

- (void)mapDidAppearOnView:(nonnull UIView *)aView {
    [self.naviManager mapDidAppearOnView:aView];
}

- (void)mapWillAppearOnView:(nonnull UIView *)aView {
    [self.naviManager mapWillAppearOnView:aView];
}

- (void)mapWillDisappearOnView:(nonnull UIView *)aView {
    [self.naviManager mapWillDisappearOnView:aView];
}

- (void)removeDriveView:(nonnull ADNaviDriveView *)driveView {
    [self.naviManager removeDriveView:driveView];
}

- (void)setupStrategy:(NSInteger)strategy {
    [self.naviManager setupStrategy:strategy];
}

- (void)setIsSimulateNav:(BOOL)isSimulateNav
{
    [self.naviManager setIsSimulateNav:isSimulateNav];
}

- (void)startNavigationFrom:(CLLocationCoordinate2D)aLoc toB:(CLLocationCoordinate2D)bLoc {
    [self.naviManager startNavigationFrom:aLoc toB:bLoc];
}

- (void)stopNavigation {
    [self.naviManager stopNavigation];
}

#pragma mark - ADNavigationMangerDelegate 方法

- (void)navigationManager:(id<ADNaviManagerProtocol>)manager updateRouteInfo:(ADNaviRouteInfo *)routeInfo type:(ADNavigationRouteType)routeType
{
    [self.delegate navigationManager:self updateRouteInfo:routeInfo type:routeType];
}

- (void)navigationManager:(id<ADNaviManagerProtocol>)manager occurError:(NSError *)error type:(ADNavigationErrorType)errorType
{
    [self.delegate navigationManager:self occurError:error type:errorType];
}

- (void)navigationManager:(id<ADNaviManagerProtocol>)manager occurEvent:(ADNavigationEventType)evenType context:(nonnull id)context
{
    [self.delegate navigationManager:self occurEvent:evenType context:context];
}

///导航点更新
- (void)navigationManager:(id<ADNaviManagerProtocol>)manager updateLocation:(ADLocationModel *)naviLocation
{
    [self.delegate navigationManager:self updateLocation:naviLocation];
}

- (BOOL)navigationManagerNeedBroadcastVoice:(ADMANaviManager *)manager
{
    return [self.delegate navigationManagerNeedBroadcastVoice:self];
}

@end
